<?php
namespace app\common\logic;
use app\common\model\RegionModel;
class CommonLogic
{
    public static function checkSmsCode($phoneCode)
    {
        if($phoneCode == session('mobileCode') && time() <= session('SMSLifeTime')){
            return true;
        }
        return false;
    }

    /**
     * 密码加密
     */
    public static function encryptionPassword($phone,$password)
    {
       return md5(md5($phone) . md5($password));

    }

    //合伙人的加密方式,
    public static function partnerPwdEncrypt($password)
    {
        $salt='partner2483902';
        $water='ewiu123103';
        return md5(md5($salt.$password.$water));
    }

    //经销商的加密方式,密码加密，因为当更改手机号时，密码的加密方式应该要和账号无关
    public static function passwordEncrypt($password)
    {
        $salt='swap289019134';
        return md5(md5($password.$salt));
    }




    /**
     * 获取省，市，区
     */
    public static function getRegion($regionType)
    {
        return RegionModel::all(['region_type'=>$regionType]);
    }
}